<template>
  <div class="container-content">
    <el-row>
      <el-col :span="24">
        <h3 class="panel-title">新增开票</h3>
      </el-col>
    </el-row>
    <el-form
      ref="formRef"
      :model="formObject"
      label-width="100px"
      label-position="left"
    >
      <el-card shadow="never">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="账号" label-width="110px">
              <el-input v-model="formObject.account"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="供应商" label-width="110px">
              <el-input v-model="formObject.supplierId"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="开票公司名称" label-width="110px">
              <el-input v-model="formObject.invoicingCompany"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开户银行" label-width="110px">
              <el-input v-model="formObject.openingBank"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="开户名称" label-width="110px">
              <el-input v-model="formObject.openingName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开户地址" label-width="110px">
              <el-input v-model="formObject.openingAddress"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="纳税人识别号" label-width="110px">
              <el-input v-model="formObject.taxpayerIdNum"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="期初未开票金额" label-width="110px">
              <el-input v-model="formObject.uninvoicedAmount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注" label-width="110px">
              <el-input v-model="formObject.remarks" type="textarea"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-form-item label-width="0px" style="margin-top: 20px">
        <el-button type="primary" @click="onSubmit">保存</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { addInvoiceContract } from "@/api/system/contract";

export default {
  data() {
    return {
      formObject: {
        account: "",
        changeTime: "",
        createTime: "",
        id: "",
        invoicingCompany: "",

        openingAddress: "",
        openingBank: "",
        openingName: "",
        supplierId: "",
        taxpayerIdNum: "",
        uninvoicedAmount: "",
        userId: "",
      },
    };
  },
  methods: {
    onSubmit() {
      this.formObject.id = Date.now();
      addInvoiceContract(this.formObject).then((res) => {
        if (res.code === 200) {
          this.$message({
            message: "新增成功！",
            type: "success",
          });
          this.$router.push({ path: "/Contract/Invoicing" });
        }
      });
    },
  },
  created() {},
};
</script>
<style lang="scss" scoped></style>
